<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/loginredirect.jsp"%>
<head>
    <title><fmt:message key="menu.js4"/></title>
    <meta name="heading" content="<fmt:message key='menu.js4'/>"/>
    <meta name="menu" content="FormsMenu"/>
</head>

<div class="jquery_tab_container">
    <span class="heading_tab advanced_link active tab1"><fmt:message key="menu.js4"/></span>
</div>

<div class="jquery_tab">
    <div class="content_block"></div>
    <p class="buttonBar bottom"  style="border-bottom: 1px solid #ccc; margin-bottom: 10px;">
        <input class="button" type="button" style="margin-right: 5px" onclick="location.href='<c:url value="/assessmentsearchform"/>'" value="<fmt:message key="button.add"/>"/>
        <input type="button" class="button" name="cancel" value="<fmt:message key="button.cancel"/>" onclick="location.href='<c:url value="/menuForms"/>'"/>

    </p>
    <form:form commandName="assessmentsForm" method="post" action="searchAssessments" id="assessmentsForm" onsubmit="return validateWork(this)">
        <form:errors path="*" cssClass="error" element="div"/>
        <form:hidden path="assessment.id"/>
        <h3><fmt:message key="search.ocenuvanja" /></h3><br />
        <p>
        <appfuse:label styleClass="width150 left" key="searchPerson.firstName"/>
        <form:input path="assessment.workPosition.employment.firstName" id="assessment.workPosition.employment.firstName" cssClass="input-medium toCyr" cssErrorClass="text medium error" maxlength="50"/>
        </p>
        <p>
        <appfuse:label styleClass="width150 left" key="searchPerson.lastName"/>
        <form:input path="assessment.workPosition.employment.lastName" id="assessment.workPosition.employment.lastName" cssClass="input-medium toCyr" cssErrorClass="text medium error" maxlength="50"/>
        </p>
        <p>
        <appfuse:label styleClass="width150 left" key="searchPerson.socScrNo"/>
        <form:input path="assessment.workPosition.employment.socScrNo" id="assessment.workPosition.employment.socScrNo"  cssClass="input-medium toCyr" cssErrorClass="text medium error" maxlength="50"/>
        </p>
        <p>
        <appfuse:label styleClass="width150 left" key="searchPerson.position"/>
        <form:input path="assessment.workPosition.position" id="assessment.workPosition.position" cssClass="input-medium toCyr" cssErrorClass="text medium error" maxlength="50"/>
</p>
        <p>
       
            <appfuse:label styleClass="width150 left" key="searchPerson.assHalf"/>
            <form:select path="assessment.assHalf" id="assessment.assHalf">
                <form:option id="1" value="">
                    <fmt:message key='assHalfSearch'/>
                </form:option>
                <c:if test="${'1' == assessmentsForm.assessment.assHalf}"> <form:option id="2" value="1" selected="true" /> </c:if>  <c:if test="${'1' != assessmentsForm.assessment.assHalf}"> <form:option id="2" value="1" /> </c:if>
                <c:if test="${'2' == assessmentsForm.assessment.assHalf}"> <form:option id="3" value="2" selected="true" /> </c:if>  <c:if test="${'2' != assessmentsForm.assessment.assHalf}"> <form:option id="3" value="2" /> </c:if>
            </form:select>
        </p>
        <p>
            <appfuse:label styleClass="width150 left" key="searchPerson.assYear"/>
            <form:input path="assessment.assYear" id="assessment.assYear" cssClass="input-medium" cssErrorClass="text medium error" maxlength="50"/>
       </p>
        <p>
            <appfuse:label styleClass="width150 left" key="searchPerson.isAssessed"/>
            <form:select path="assessment.isAssessed" id="assessment.isAssessed">
                <form:option id="1" value="">
                    <fmt:message key='isAssessedSearch'/>
                </form:option>
                <c:if test="${true == assessmentsForm.assessment.isAssessed}"> 
                    <form:option id="2" value="true" selected="true" > 
                        <fmt:message key='assessed'/> 
                    </form:option> 
                </c:if>  
                <c:if test="${true != assessmentsForm.assessment.isAssessed}"> 
                    <form:option id="2" value="true" > 
                        <fmt:message key='assessed'/>
                    </form:option> 
                </c:if>
                <c:if test="${false == assessmentsForm.assessment.isAssessed}"> 
                    <form:option id="3" value="false" selected="true" > 
                        <fmt:message key='unassessed'/> 
                    </form:option> 
                </c:if>  
                <c:if test="${false != assessmentsForm.assessment.isAssessed}"> 
                    <form:option id="3" value="false" > 
                        <fmt:message key='unassessed'/> 
                    </form:option> 
                </c:if>
            </form:select>
        </p>
      
        <%--<li>
            <appfuse:label styleClass="desc" key="searchPerson.assessment"/>
            <form:errors path="assessment.assessment" cssClass="fieldError"/>
            <form:input path="assessment.assessment" id="assessment.assessment" cssClass="text medium" cssErrorClass="text medium error"  />
        </li>--%>
         <p>
            <appfuse:label styleClass="width150 left" key="searchPerson.assessment"/>
            <form:select path="assessment.assmark.id" id="assMarkSelect">
                <form:option id="1" value="">
                    <fmt:message key='assMarkSearch'/>
                </form:option>
                <c:forEach items="${assessmentsForm.assessmentMark}" var="reason">

                    <c:if test="${reason == assessmentsForm.assessment.assmark}">
                        <form:option value="${reason.id}" id="${workPositionForm.assessment.assmark.id}" selected="true">
                            ${reason.name}
                        </form:option>
                    </c:if>
                    <c:if test="${reason != assessmentsForm.assessment.assmark }">
                        <form:option value="${reason.id}" id="${workPositionForm.assessment.assmark.id}" >
                            ${reason.name}
                        </form:option>
                    </c:if>
                </c:forEach>
            </form:select>
        </p>
        <p>
            <appfuse:label styleClass="width150 left" key="assessment.unassessedReason"/>
            <form:select path="assessment.unassReason.id" id="unassessedReasonSelect">
                <form:option id="1" value="">
                    <fmt:message key='unassReasonSearch'/>
                </form:option>
                <c:forEach items="${assessmentsForm.unassessedReason}" var="reason">

                    <c:if test="${reason == assessmentsForm.assessment.unassReason}">
                        <form:option value="${reason.id}" id="${workPositionForm.assessment.unassReason.id}" selected="true">
                            ${reason.name}
                        </form:option>
                    </c:if>
                    <c:if test="${reason != assessmentsForm.assessment.unassReason }">
                        <form:option value="${reason.id}" id="${workPositionForm.assessment.unassReason.id}" >
                            ${reason.name}
                        </form:option>
                    </c:if>
                </c:forEach>
            </form:select>
       
            </p>
           
        <input type="submit" class="button" name="search" value="<fmt:message key="button.search"/>"/>
        <br /><br />
    </form:form>

    <display:table name="searchAssessmentsList" class="table" requestURI="" id="searchAssessmentsList" export="false" pagesize="25">
        <display:column property="workPosition.employment.firstName" titleKey="employment.firstName" sortable="true" href="assessmentform?" media="html"
                        paramId="id" paramProperty="id" />
        <display:column property="workPosition.employment.lastName" sortable="true" titleKey="basicInfo.lastName"/>
        <display:column property="workPosition.employment.fathersName" sortable="true" titleKey="basicInfo.fathersName"/>
        <display:column property="workPosition.employment.socScrNo" sortable="true" titleKey="basicInfo.socScrNo"/>
        <display:column property="workPosition.employment.gender" sortable="true" titleKey="basicInfo.gender"/>
        <display:column property="workPosition.position" sortable="true" titleKey="basicInfo.position"/>
        <display:column property="assHalf" sortable="true" titleKey="basicInfo.assHalf"/>
        <display:column property="assYear" sortable="true" titleKey="basicInfo.assYear"/>
        <display:column property="isAssessed" sortable="true" titleKey="basicInfo.isAssessed"/>
        <display:column property="assessment" sortable="true" titleKey="basicInfo.assessment"/>
        <display:column property="unassReason.name" sortable="true" titleKey="basicInfo.unassReason"/>
    </display:table>
</div>
<v:javascript formName="assessmentsForm" cdata="false" dynamicJavascript="true" staticJavascript="false"/>
<script type="text/javascript" src="<c:url value='/scripts/validator.jsp'/>"></script>

<script type="text/javascript">
    Form.focusFirstElement($('assessmentsForm'));
</script>

<script type="text/javascript">
    highlightTableRows("searchAssessmentsList");
</script> 